feat(chat): add /detect slash command for mid-session re-detection#102
feat(chat): add /detect slash command for mid-session re-detection#102michaelroy-amd wants to merge 2 commits into
Conversation
Once ChatConsent::Accepted, the pre-accept 'd' gate key is unreachable (it's ordinary chat text when focused, and unbound when unfocused), so there was no way to re-run local-engine detection after the initial handshake without restarting the app. Add a `/detect [accept|save|dismiss]` slash command that reuses the existing request_detect/accept_detect_offer/save_detect_offer/ dismiss_detect_offer reducer methods. A bare `/detect` raises the same probe used at startup and echoes the result into the chat transcript (the offer y/s/n UI is never drawn once Accepted, since draw() only renders it pre-accept). `/detect accept` and `/detect save` route through the same code path as the initial accept, so a re-detect mid- session raises the chat_endpoint_rebuild edge exactly like startup does, swapping the live agent to the newly detected endpoint. Relates to EAI-7354. Signed-off-by: Michael Roy <michael.roy@amd.com>
… offer Two consistency refinements to the /detect slash command: - Lowercase the sub-command before matching, so `/detect ACCEPT` etc. behave like the lowercase forms — mirroring the case-insensitive parsing of the sibling `/permissions` and `/provider` commands. - Emit a short hint turn when `/detect accept` or `/detect save` is used with no pending detected endpoint (previously a silent reducer no-op), pointing the user at bare `/detect` to probe first. Relates to EAI-7354. Signed-off-by: Michael Roy <michael.roy@amd.com>
rominf
left a comment
There was a problem hiding this comment.
LGTM. /detect dispatch/parsing mirrors sibling slash commands (case-insensitive sub-command via split_whitespace().nth(1), whitespace-robust), and it routes straight through the existing accept_detect_offer / save_detect_offer / dismiss_detect_offer reducers rather than reimplementing detection. /detect accept raises chat_endpoint_rebuild identically to the initial pre-accept accept (asserted by test). The feature is correctly scoped to post-Accepted state.
Minor UX nit: a bare /detect while an offer is already pending is a silent no-op (early return on chat_detect_offer.is_some()) with no on-screen feedback post-accept — a one-line "an endpoint is already pending — /detect accept|dismiss first" hint would close it.
Approving.
|
🔴 Automated review · pr-review-watcher · 15979fa SummaryAdds a 🚫 Blocking (must fix before merge)None. Non-blocking
|
Summary
/detect [accept|save|dismiss]slash command so a local chatengine can be re-detected after
ChatConsent::Accepted, without adedicated keybinding colliding with focused chat text entry.
/detectre-runs the same probe used at startup(
detect_local_chat: managed-services registry, then Lemonade:13305 / vLLM :8000 / rocm serve :11435) and echoes the result into
the chat transcript.
/detect accept//detect save//detect dismissroute throughthe existing
accept_detect_offer/save_detect_offer/dismiss_detect_offerreducer methods.Root cause
Once chat is
ChatConsent::Accepted, the pre-accept'd'gate key isunreachable: while a text field is focused a bare
dkeypress isordinary chat input, and when unfocused the global hotkey table does
not bind
'd'for the Chat tab. There was no way to react to a localengine coming online (or changing) after the initial handshake short
of restarting the app.
Fix
slash.rs: new"detect"branch dispatches to the pre-existingAppStatereducer methods used by the pre-accept offer UI, so nonew detection or endpoint-swap plumbing was introduced.
app/mod.rs:request_detect()now also echoes a "Detecting…" message into thetranscript when already
Accepted(previously this messaging onlymade sense pre-accept, driving the gate UI).
set_detect_result()echoes the found/not-found result into thetranscript when
Accepted, sincedraw()only renders theoffer y/s/n prompt pre-accept (confirmed in
ui/tabs/chat.rs) —without this the probe result would be silently discarded once
accepted.
/detect accept//detect savegoes through the sameaccept_detect_offer/save_detect_offercalls the initial pre-accept flow uses, so itraises the
chat_endpoint_rebuilddispatch edge (introduced inPR fix(dash): rebuild live chat agent when a local endpoint is accepted #81) exactly like the initial accept does, swapping the live
agent to the newly detected endpoint.
Coordination notes
app/mod.rs,slash.rs), adifferent surface than PR fix(dash): prefer a local chat server over the cloud default at startup #100 (
fix/chat-startup-local-first,which only touches the
event_loop()startup block) and thanunmerged upstream PR fix(dash): discover served model for configured chat endpoint #97 (which touches
resolve_llm_config'sfallback and the startup block). No overlapping hunks expected.
Relates to EAI-7354.
Test Plan
cargo build -p rocm-dash-tuicargo clippy -p rocm-dash-tui --all-targets --all-features(clean,-D warnings)cargo test -p rocm-dash-tui -- --test-threads=1(551 passed, 0 failed)slash_detect_probes_and_echoes_result_while_acceptedslash_detect_accept_raises_endpoint_rebuild_like_initial_acceptslash_detect_dismiss_and_unknown_subcommand